<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main2"/>
    <g:set var="entityName" value="${message(code: 'playPosition.label', default: 'PlayPosition')}"/>
    <title>场地</title>
</head>
<body>
<div class="main-body">
    <div class="page-wrapper">
        <div class="page-header">
            <div class="page-header-title">
                <h4>场地</h4>
            </div>

            <div class="page-header-breadcrumb">
                <ul class="breadcrumb-title">
                    <li class="breadcrumb-item">
                        <a href="/salesDashboard/index">
                            <i class="icofont icofont-home"></i>
                        </a>
                    </li>
                    <li class="breadcrumb-item"><a href="#!">场地</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="page-body">
            <div class="card">
                <div class="card-header">
                    <h5>打位管理</h5>
                    <div class="card-header-right">
                        <g:link action="create"><i class="ion-plus"></i> 新增</g:link>
                    </div>
                </div>

                <div class="card-block dt-responsive">
                    <div class="table-responsive">
                        <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">
                            <g:form method="POST" action="searchPlayPosition">
                                <div class="row m-0">
                                    <div class="col-md-8 p-l-0">

                                        <div class="form-group row">
                                            <div class="col-md-3">
                                                <g:select class="form-control" name="contact" id="contact" optionValue="fullName" optionKey="id" from="${com.next.Contact.list()}" value="${params?.contact?.id}" noSelection="${['': '客户']}"/>
                                            </div>
                                            <div class="col-md-3">
                                                <input type="text" class="form-control" placeholder="手机号" name="cellphone" id="name" value="${params?.cellphone}">
                                            </div>
                                            <div class="col-md-3">
                                                <g:select class="form-control" name="status" id="status" from="${com.next.PlayPosition.constrainedProperties.status.inList}" value="${params?.status}" noSelection="${['': '打位状态']}"/>
                                            </div>
                                        </div>

                                    </div>
                                    <div class="col-md-4 p-r-0 dt-buttons text-right">
                                            <button class="btn btn-inverse btn-sm btn-squeare" type="submit"><i class="fa fa-search"></i></button>
                                            <button class="btn btn-inverse btn-sm btn-squeare" type="button" id="resetBtn"><i class="fa fa-refresh"></i></button>
                                    </div>
                                </div>
                            </g:form>

                            <table class="table table-striped  table-bordered table-hover">
                                <thead>
                                <tr>
                                    <g:sortableColumn property="code" title="编号"/>
                                    <g:sortableColumn property="fullName" title="客户名称"/>
                                    <g:sortableColumn property="cellphone" title="手机号"/>
                                    <g:sortableColumn property="name" title="打位"/>
                                    <g:sortableColumn property="status" title="打位状态"/>
                                    <g:sortableColumn property="level" title="客户级别"/>
                                    <g:sortableColumn property="createBy" title="创建人"/>
                                    <g:sortableColumn property="modifyBy" title="修改人"/>
                                    <g:sortableColumn property="createdDate" title="创建时间"/>
                                </thead>
                                <tbody>
                                <g:each in="${[]}">
                                    <tr>
                                        <td><g:link action="show" id="${it?.id}" class="firstTd">${it?.id}</g:link></td>
                                        <td>${it?.contact?.fullName}</td>
                                        <td>${it?.contact?.cellphone}</td>
                                        <td>${it?.name}</td>
                                        <td>${it?.status}</td>
                                        <td>${it?.contact?.level?.name}</td>
                                        <td>${it?.createBy?.fullName}</td>
                                        <td>${it?.modifyBy?.fullName}</td>
                                        <td><g:formatDate format="yyyy-MM-dd HH:mm:ss" date="${it?.createdDate}"/></td>
                                    </tr>
                                </g:each>
                                </tbody>
                            </table>

                            <div class="dataTables_paginate">
                                <div class="pagination">
                                    <g:paginate total="${playPositionCount ?: 0}" params="${params}"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>一层打位</h5>
                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div style="padding: 10px;margin:10px;display: flex; justify-content: center;">
                        <g:each in="${com.next.PlayPosition.findAllByLevel('一层')}">
                            <g:if test="${it?.status == '可选'}">
                                <div class="circle" style="border:1px solid;width:30px;height:30px;border-radius:15px;float: left;margin: 10px" dataId="${it?.id}">${it?.name}</div>                                
                            </g:if>
                            <g:else>
                                <div class="circle" style="border:1px solid;width:30px;height:30px;border-radius:15px;float: left;margin: 10px;background: red;" dataId="${it?.id}">${it?.name}</div>
                            </g:else>
                        </g:each>
                    </div>
                </div>

                <div class="card">
                    <div class="card-header">
                        <h5>二层打位</h5>
                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>
                    <div style="padding: 10px;margin:10px;display: flex; justify-content: center;">
                        <g:each in="${com.next.PlayPosition.findAllByLevel('二层')}">
                            <g:if test="${it?.status == '可选'}">
                                <div class="circle" style="border:1px solid;width:30px;height:30px;border-radius:15px;float: left;margin: 10px" dataId="${it?.id}">${it?.name}</div>                                
                            </g:if>
                            <g:else>
                                <div class="circle" style="border:1px solid;width:30px;height:30px;border-radius:15px;float: left;margin: 10px;background: red;" dataId="${it?.id}">${it?.name}</div>
                            </g:else>
                        </g:each>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>
<g:javascript>
    $(function(){
        $("#resetBtn").click(function () {
            $("#name").val("");
        });

        $(".circle").click(function() {
            alert("ddddddddddd");
            var dddd = $(this).attr("dataId").trim();
            alert(dddd);
        })
    });
</g:javascript>
</body>
</html>
